<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <input type="text" id="one">
    <button id="a">+</button>
    <button id="b">-</button>
    <button id="c">*</button>
    <button id="d">/</button>
    <input type="text" id="two">
    <button id="e">=</button>
    <input type="text" id="jieguo">
    <script>

        var ys = ''
        a.onclick = function () {
            ys = '+'
        }
        b.onclick = function () {
            ys = '-'
        }
        c.onclick = function () {
            ys = '*'
        }
        d.onclick = function () {
            ys = '/'
        }
        console.log(a, b, c, d);
        e.onclick = function () {
            switch (ys) {
                case '+':
                    jieguo.value = +one.value + +two.value
                    one.value = ''
                    two.value = ''
                    break;
                case '-':
                    jieguo.value = one.value - two.value
                    one.value = ''
                    two.value = ''
                    break;
                case '*':
                    jieguo.value = one.value * two.value
                    one.value = ''
                    two.value = ''
                    break;
                case '/':
                    jieguo.value = one.value / two.value
                    one.value = ''
                    two.value = ''
                    break;
            }
        }
    </script>


</body>

</html>